import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    title: '流行',
    level: 0
  },
  actions: {
    changeTab (ctx, title) {
      ctx.commit('changeTab', title)
    },
    showHeadBack (ctx, level) {
      ctx.commit('showHeadBack', level)
    }
  },
  mutations: {
    changeTab (state, title) {
      state.title = title
    },
    showHeadBack (state, level) {
      state.level += level
    }
  }
})
